<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script src="easyui/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="easyui/uploadify/uploadify.css">

</head>
<body>
<div id="queue"></div>   <!-- 进度条标签 -->
<input id="file_upload" name="photo" type="file"  />  <!-- //上传组件标签 -->
<!-- <div  id="imglist"></div>图片显示标签 -->
<input type="hidden" name="gphoto" id="imgpath"  /> <!-- //上传的路径标签 -->


 <input onclick="download()" type="button" value="下载"/>  
  <script type="text/javascript">
  var dd=null;
  
  
  $(function(){
	  $('#file_upload').uploadify({
		  
			 
			'swf'      : '<%=request.getContextPath() %>/easyui/uploadify/uploadify.swf',//动画地址
			'uploader' : '<%=request.getContextPath() %>/write_mln/uploadphoto',  //上传的action地址
			'fileTypeExts'  :   '*.gif;*.jpg;*.png;*.bmp',  //允许上传的文件格式
			'multi'             :   false,   //是否开启多文件上传
			'method'            :   'post', //提交方式
			'fileObjName':'photo',    //服务器 接收的文件名称  
			'buttonText':'上传',
          'onUploadSuccess' : function(file,data) {  
          //参数data服务端输出返回的信息
           
            $("#imglist").append("<img  src='<%=request.getContextPath() %>/upload/"+data+"'  width=30 height=30  />")
             
         /*    $("#imgpath").val(data); */
         dd=data;
         
          $.ajax({
        	  url:"<%=request.getContextPath() %>/write_mln/ftpupload",
        	  type:"post",
        	  data:{"newpath":data},
        	  async:true,
        	  success:function(res){
        		  var blo=eval("("+res+")");
        		  if(blo){
        			 alert("上传成功"); 
        		  }
        	  }
          })
      },  
		});
	
  })

	
			
			
	function download(){
	  $.ajax({
		  url:"<%=request.getContextPath() %>/write_mln/ftpdownload",
		  type:"post",
		  data:{"newname":dd},
		  async:true,
		  success:function(res){
			  
		  }
	  })
  }		
			
			
			
	</script>  
</body>
</html>